from selenium import webdriver
from selenium.webdriver import ActionChains
import time


bro = webdriver.Chrome(executable_path='chromedriver')
bro.get('https://www.runoob.com/try/try.php?filename=jqueryui-api-droppable')

# 切换作用域，iframe是在html页面中又嵌套一个页面
bro.switch_to.frame('iframeResult')
div = bro.find_element_by_id('draggable')

# 动作链
action = ActionChains(bro)
action.click_and_hold(div)
for i in range(5):
    action.move_by_offset(17,1).perform()
    time.sleep(0.2)
action.release()
time.sleep(2)
bro.quit()